package com.course.design.socketio;

import com.corundumstudio.socketio.SocketIOServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 描述:
 *
 * @author qinlianji
 * @create 2020-02-18
 */
@Component
public class ServerRunner implements CommandLineRunner {
    private Logger logger = LoggerFactory.getLogger(MessageEventHandler.class);

    private final SocketIOServer server;

    @Autowired
    public ServerRunner(SocketIOServer server) {
        this.server = server;
    }

    @Override
    public void run(String... args) throws Exception {
        server.start();
        logger.info("socket.io 启动成功！");
    }
}
